package com.ruoyi.project.cms.knowledgemanagement.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.cms.knowledgemanagement.domain.Knowledge;
import com.ruoyi.project.cms.knowledgemanagement.service.IKnowledgeBenchmarkingService;
import com.ruoyi.project.cms.knowledgemanagement.service.IKnowledgeService;
import org.apache.commons.io.FilenameUtils;
import org.apache.shiro.io.ResourceUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.UUID;

/**
 * 知识管理控制类
 * 2020-5-16 21:59:30
 */
@Controller
@RequestMapping("/knowledgemanagement/knowledge")
public class KnowledgeController extends BaseController {

    @Autowired
    private IKnowledgeService iKnowledgeService;

    @Autowired
   private IKnowledgeBenchmarkingService iKnowledgeBenchmarkingService;


    String prefix = "/cms/knowledgemanagement";

    @GetMapping("")
    public String knowledge(){

        return prefix+"/knowledge";
    }

    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(Knowledge knowledge){
        startPage();
        List<Knowledge> list = iKnowledgeService.findMore(knowledge);
        return getDataTable(list);
    }

    /**
     * 查看
     */
    @GetMapping("/detail/{project_id}")
    public String edit(@PathVariable("project_id") Long project_id, ModelMap mmap)
    {
        mmap.put("KnowledgeBenchmarking", iKnowledgeBenchmarkingService.selectKnowledgeBenchmarkingById(project_id));
        return prefix + "/detail";
    }


}
